<?

$list = meta('list');

if (($a = (int)param('edit')) && ($DATA['object'] = datafetch('db_item', tb('list'), "id=$a AND id_list=$list"))) {

	switch (action(array('editor_save'))) {
	
		case 'editor_save':
		
			if ($t = postdata('title')) {	// some data received
				
				dataset('db_update', tb('list'), array(
					'title' => $t,
					'text' => trim(postdata('text')),
					'id_list' => $list,
				), "id=$a");	//	edition date updated
				

			} else {	// empty data
			}
			
			header("Location: "._transformURL($CURRENT->url, array('remove_param' => 'edit')));
			exit;

			break;

	}


} else {								// **** bad article ****

	header("Location: "._transformURL($CURRENT->url, array('remove_param' => 'edit')));
	exit;
}

?>